<template>
  <el-dialog
    :title="title"
    width="1200%"
    :close-on-click-modal="false"
     v-dialogDrag
    :visible.sync="visible">
    <el-form :model="inputForm" ref="inputForm" :class="method==='view'?'readonly':''"  :disabled="method==='view'" @keyup.enter.native="doSubmit()"
             label-width="120px">
      <el-row  :gutter="20">
        <el-col style="margin-top: 10px;" >
                      <div style="text-align: left;">被害人病历材料、鉴定意见</div>
                                <el-select v-model="inputForm.oneId" placeholder="请选择">
                                                            <el-option
                                                              v-for="item in $dictUtils.getDictList('danxuan')"
                                                              :key="item.value"
                                                              :label="item.label"
                                                              :value="item.value">
                                                            </el-option>
                                                          </el-select>

                    </el-radio-group>
            <el-input v-model="inputForm.put" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
            <!-- <el-form-item label="现场监控 录像" prop="twoId"
                :rules="[
                 ]">
           </el-form-item> -->
         <div style="text-align: left;">现场监控 录像</div>
        <el-select v-model="inputForm.twoId" placeholder="请选择">
                                    <el-option
                                      v-for="item in $dictUtils.getDictList('danxuan')"
                                      :key="item.value"
                                      :label="item.label"
                                      :value="item.value">
                                    </el-option>
                                  </el-select>
                    </el-radio-group>
                     <el-input v-model="inputForm.putone" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
            <!-- <el-form-item label="扣押物品清单（作案工具或其他）" prop="threeId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">扣押物品清单（作案工具或其他）</div>
                      <el-select v-model="inputForm.threeId" placeholder="请选择">
                                                  <el-option
                                                    v-for="item in $dictUtils.getDictList('danxuan')"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                  </el-option>
                                                </el-select>
                                  </el-radio-group>
                     <el-input v-model="inputForm.puttwo" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
           <!-- <el-form-item label="犯罪嫌疑人户籍材料" prop="fourId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">犯罪嫌疑人户籍材料</div>
                    <el-select v-model="inputForm.fourId" placeholder="请选择">
                                                <el-option
                                                  v-for="item in $dictUtils.getDictList('danxuan')"
                                                  :key="item.value"
                                                  :label="item.label"
                                                  :value="item.value">
                                                </el-option>
                                              </el-select>
                                </el-radio-group>
                     <el-input v-model="inputForm.putthree" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
           <!-- <el-form-item label="犯罪记录 调查证明" prop="fiveId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">犯罪记录 调查证明</div>
                      <el-select v-model="inputForm.fiveId" placeholder="请选择">
                                                  <el-option
                                                    v-for="item in $dictUtils.getDictList('danxuan')"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                  </el-option>
                                                </el-select>
                                  </el-radio-group>
                     <el-input v-model="inputForm.putfour" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
            <!-- <el-form-item label="前科材料" prop="sixId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">前科材料</div>
                 <el-select v-model="inputForm.sixId" placeholder="请选择">
                                             <el-option
                                               v-for="item in $dictUtils.getDictList('danxuan')"
                                               :key="item.value"
                                               :label="item.label"
                                               :value="item.value">
                                             </el-option>
                                           </el-select>
                             </el-radio-group>
                     <el-input v-model="inputForm.putfive" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
           <!-- <el-form-item label="发破案经过" prop="selvenId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">发破案经过</div>
                       <el-select v-model="inputForm.selvenId" placeholder="请选择">
                                                   <el-option
                                                     v-for="item in $dictUtils.getDictList('danxuan')"
                                                     :key="item.value"
                                                     :label="item.label"
                                                     :value="item.value">
                                                   </el-option>
                                                 </el-select>
                                   </el-radio-group>
                     <el-input v-model="inputForm.putsix" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
            <!-- <el-form-item label="抓获经过" prop="eightId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">抓获经过</div>
                       <el-select v-model="inputForm.eightId" placeholder="请选择">
                                                   <el-option
                                                     v-for="item in $dictUtils.getDictList('danxuan')"
                                                     :key="item.value"
                                                     :label="item.label"
                                                     :value="item.value">
                                                   </el-option>
                                                 </el-select>
                                   </el-radio-group>
                     <el-input v-model="inputForm.putselven" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
           <!-- <el-form-item label="证人证言" prop="nineId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">证人证言</div>
                   <el-select v-model="inputForm.nineId" placeholder="请选择">
                                               <el-option
                                                 v-for="item in $dictUtils.getDictList('danxuan')"
                                                 :key="item.value"
                                                 :label="item.label"
                                                 :value="item.value">
                                               </el-option>
                                             </el-select>
                               </el-radio-group>
                     <el-input v-model="inputForm.puteight" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
        <!--    <el-form-item label="被害人陈述" prop="tenId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">被害人陈述</div>
                          <el-select v-model="inputForm.tenId" placeholder="请选择">
                                                      <el-option
                                                        v-for="item in $dictUtils.getDictList('danxuan')"
                                                        :key="item.value"
                                                        :label="item.label"
                                                        :value="item.value">
                                                      </el-option>
                                                    </el-select>
                                      </el-radio-group>
                     <el-input v-model="inputForm.putnine" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="犯罪嫌疑人供述" prop="elvenId"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">犯罪嫌疑人供述</div>
                              <el-select v-model="inputForm.elvenId" placeholder="请选择">
                                                          <el-option
                                                            v-for="item in $dictUtils.getDictList('danxuan')"
                                                            :key="item.value"
                                                            :label="item.label"
                                                            :value="item.value">
                                                          </el-option>
                                                        </el-select>
                                          </el-radio-group>
                     <el-input v-model="inputForm.putten" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="其他证据（刑事和解、情况说明等）" prop="twelven"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">其他证据（刑事和解、情况说明等）</div>
                           <el-select v-model="inputForm.twelven" placeholder="请选择">
                                                       <el-option
                                                         v-for="item in $dictUtils.getDictList('danxuan')"
                                                         :key="item.value"
                                                         :label="item.label"
                                                          :value="item.value">
                                                       </el-option>
                                                     </el-select>
                                       </el-radio-group>
                     <el-input v-model="inputForm.puteleven" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
      <!--      <el-form-item label="需要说明的问题" prop="threeteen"
                :rules="[
                 ]">
           </el-form-item> -->
                   <div style="text-align: left;">需要说明的问题</div>
                         <el-select v-model="inputForm.threeteen" placeholder="请选择">
                                                     <el-option
                                                       v-for="item in $dictUtils.getDictList('danxuan')"
                                                       :key="item.value"
                                                       :label="item.label"
                                                       :value="item.value">
                                                     </el-option>
                                                   </el-select>
                                     </el-radio-group>
                     <el-input v-model="inputForm.puttwelve" ></el-input>
        </el-col>
        </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">关闭</el-button>
      <el-button v-if="method !== 'view'" :plain="true" type="primary" @click="doSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        title: '',
        method: '',
        visible: false,
        oldInputForm: '',
        inputForm: {
          id: '',
          put: '',
          putone: '',
          puttwo: '',
          putthree: '',
          putfour: '',
          putfive: '',
          putsix: '',
          putselven: '',
          puteight: '',
          putnine: '',
          putten: '',
          puteleven: '',
          puttwelve: '',
          putthirteen: '',
          skys: '1',
          testDataMain: {
            id: ''
          },
          oneId: '',
          twoId: '',
          threeId: '',
          fourId: '',
          fiveId: '',
          sixId: '',
          selvenId: '',
          eightId: '',
          nineId: '',
          tenId: '',
          elvenId: '',
          twelven: '',
          threeteen: '',
          remarks: ''
        }
      }
    },
    // watch: {
    //   'inputForm.oneId': function (newVal, oldVal) {
    //     console.log(newVal)
    //   }
    // },
    watch: {
      // 路径改变时候 关闭组件bug
      $route (newVal, oldVal) {
        this.visible = false
      }
    },
    components: {
    },
    methods: {
      init (method, obj) {
        this.method = method
        if (method === 'add') {
          this.title = `新建故意伤害罪证据指引`
        } else if (method === 'edit') {
          this.title = '修改故意伤害罪证据指引'
        } else if (method === 'view') {
          this.title = '查看故意伤害罪证据指引'
        }
        this.visible = true
        this.$nextTick(() => {
          this.$refs.inputForm.resetFields()
          this.inputForm.id = ''
          this.oldInputForm = ''
          if (method === 'edit' || method === 'view') { // 修改或者查看
            this.oldInputForm = obj
            this.inputForm = JSON.parse(JSON.stringify(obj))
          }
        })
      },
   // 表单提交
      doSubmit () {
        this.$refs['inputForm'].validate((valid) => {
          if (valid) {
            this.$emit('addRow', this.oldInputForm, JSON.parse(JSON.stringify(this.inputForm)))
      if ((this.inputForm.oneId === '1' | this.inputForm.put !== '') & (this.inputForm.twoId === '1' | this.inputForm.putone !== '') & (this.inputForm.threeId === '1' | this.inputForm.puttwo !== '') & (this.inputForm.fourId === '1' | this.inputForm.putthree !== '') & (this.inputForm.fiveId === '1' | this.inputForm.putfour !== '') & (this.inputForm.sixId === '1' | this.inputForm.putfive !== '') & (this.inputForm.selvenId === '1' | this.inputForm.putsix !== '') & (this.inputForm.eightId === '1' | this.inputForm.putselven !== '') & (this.inputForm.nineId === '1' | this.inputForm.puteight !== '') & (this.inputForm.tenId === '1' | this.inputForm.putnine !== '') & (this.inputForm.elvenId === '1' | this.inputForm.putten !== '') & (this.inputForm.twelven === '1' | this.inputForm.puteleven !== '') & (this.inputForm.threeteen === '1' | this.inputForm.puttwelve !== '')) {
         console.log(this.inputForm.oneId)
         this.$emit('axx', '齐全')
        } else if (((this.inputForm.oneId === '' | this.inputForm.oneId === '2') & this.inputForm.put === '') | ((this.inputForm.twoId === '' | this.inputForm.twoId === '2') & this.inputForm.putone === '') | ((this.inputForm.threeId === '' | this.inputForm.threeId === '2') & this.inputForm.puttwo === '') | ((this.inputForm.fourId === '' | this.inputForm.fourId === '2') & this.inputForm.putthree === '') | ((this.inputForm.fiveId === '' | this.inputForm.fiveId === '2') & this.inputForm.putfour === '') | ((this.inputForm.sixId === '' | this.inputForm.sixId === '2') & this.inputForm.putfive === '') | ((this.inputForm.selvenId === '' | this.inputForm.selvenId === '2') & this.inputForm.putsix === '') | ((this.inputForm.eightId === '' | this.inputForm.eightId === '2') & this.inputForm.putselven === '') | ((this.inputForm.nineId === '' | this.inputForm.nineId === '2') & this.inputForm.puteight === '') | ((this.inputForm.tenId === '' | this.inputForm.tenId === '2') & this.inputForm.putnine === '') | ((this.inputForm.elvenId === '' | this.inputForm.elvenId === '2') & this.inputForm.putten === '') | ((this.inputForm.twelven === '' | this.inputForm.twelven === '2') & this.inputForm.puteleven === '') | ((this.inputForm.threeteen === '' | this.inputForm.threeteen === '2') & this.inputForm.puttwelve === '')) {
      this.$emit('axx', '不齐全')
        }
            this.visible = false
          }
        })
        this.$emit('values', 1)
      },
      open () {
            this.$message({
                  showClose: true,
                  message: '请填写证据是否齐全',
                  type: 'warning'
                })
      },
      continueDoSubmit () {
        this.$refs['inputForm'].validate((valid) => {
          if (valid) {
            this.$emit('addRow', this.oldInputForm, JSON.parse(JSON.stringify(this.inputForm)))
    if ((this.inputForm.oneId === '1' | this.inputForm.put !== '') & (this.inputForm.twoId === '1' | this.inputForm.putone !== '') & (this.inputForm.threeId === '1' | this.inputForm.puttwo !== '') & (this.inputForm.fourId === '1' | this.inputForm.putthree !== '') & (this.inputForm.fiveId === '1' | this.inputForm.putfour !== '') & (this.inputForm.sixId === '1' | this.inputForm.putfive !== '') & (this.inputForm.selvenId === '1' | this.inputForm.putsix !== '') & (this.inputForm.eightId === '1' | this.inputForm.putselven !== '') & (this.inputForm.nineId === '1' | this.inputForm.puteight !== '') & (this.inputForm.tenId === '1' | this.inputForm.putnine !== '') & (this.inputForm.elvenId === '1' | this.inputForm.putten !== '') & (this.inputForm.twelven === '1' | this.inputForm.puteleven !== '') & (this.inputForm.threeteen === '1' | this.inputForm.puttwelve !== '')) {
         console.log("进来了")
          this.$emit('axx', '齐全')
        } else if (((this.inputForm.oneId === '' | this.inputForm.oneId === '2') & this.inputForm.put === '') | ((this.inputForm.twoId === '' | this.inputForm.twoId === '2') & this.inputForm.putone === '') | ((this.inputForm.threeId === '' | this.inputForm.threeId === '2') & this.inputForm.puttwo === '') | ((this.inputForm.fourId === '' | this.inputForm.fourId === '2') & this.inputForm.putthree === '') | ((this.inputForm.fiveId === '' | this.inputForm.fiveId === '2') & this.inputForm.putfour === '') | ((this.inputForm.sixId === '' | this.inputForm.sixId === '2') & this.inputForm.putfive === '') | ((this.inputForm.selvenId === '' | this.inputForm.selvenId === '2') & this.inputForm.putsix === '') | ((this.inputForm.eightId === '' | this.inputForm.eightId === '2') & this.inputForm.putselven === '') | ((this.inputForm.nineId === '' | this.inputForm.nineId === '2') & this.inputForm.puteight === '') | ((this.inputForm.tenId === '' | this.inputForm.tenId === '2') & this.inputForm.putnine === '') | ((this.inputForm.elvenId === '' | this.inputForm.elvenId === '2') & this.inputForm.putten === '') | ((this.inputForm.twelven === '' | this.inputForm.twelven === '2') & this.inputForm.puteleven === '') | ((this.inputForm.threeteen === '' | this.inputForm.threeteen === '2') & this.inputForm.puttwelve === '')) {
      console.log(789456)
      this.$emit('axx', '不齐全')
        }
            this.$refs['inputForm'].resetFields()
          }
        })
      }
    }
  }
</script>
